/*class BookLib
 *
 *usage: init other pages
 *and to provide the APIs to html
 *
 *
 *
 *since version: 0.4
 *
 */
//instance
var bookLib;
//class
function BookLib()
{
    userManager = new UserManager();
    bookManager = new BookManager();
    
    logger = new Logger();
    librarian = new Librarian();
    searcher = new Searcher();

    defaultPage = new DefaultPage();
    searchPage = new SearchPage();
    loginBox = new LoginBox();
    signUpBox = new SignUpBox();
    profilePage = new ProfilePage();
}
BookLib.prototype.load = function()
{
    searchPage.load();
    loginBox.load();
    signUpBox.load();
    profilePage.load();
}
BookLib.prototype.show = function()
{
    defaultPage.show();
    searchPage.show();
    this.solveFregment();
}
//URL fregment handler
BookLib.prototype.solveFregment = function()
{
    
}
//APIs
BookLib.prototype.showProfilePage = function()
{
    profilePage.show();
}
BookLib.prototype.showLoginBox = function()
{
    loginBox.show();
}
BookLib.prototype.showSignUpBox = function()
{
    loginBox.showoff();
    signUpBox.show();
}
BookLib.prototype.showSearchPage = function()
{
    searchPage.show();
}
BookLib.prototype.summitLogin = function()
{
    loginBox.login();
}
BookLib.prototype.summitLogout = function()
{
    logger.logout();
}
BookLib.prototype.summitRegistration = function()
{
    if(!signUpBox.checkPassword())
    {
	Show("两次输入的密码不相同");
	return false;
    }
    if(signUpBox.regist())
    {
	return true;
    }
    else
    {
	return false;
    }
}
BookLib.prototype.checkPassword = function()
{
    signUpBox.checkPassword();
}
BookLib.prototype.showSearchHint = function()
{
}
BookLib.prototype.showHeaderSearchHint = function()
{
}
BookLib.prototype.searchViaSearchBox = function()
{
    searchPage.applySearch();
}
BookLib.prototype.searchViaHeaderSearchBox = function()
{
    defaultPage.applyHeaderSearch();
}
BookLib.prototype.checkoutBook = function()
{
    alert(this.class);
}
BookLib.prototype.returnBook = function()
{
    alert(this.class);
}